package noodhttp

import (
	"github.com/gin-gonic/gin"
	"net/http"
)

// 返回错误
// code:错误码
// msg:错误信息
func Err(c *gin.Context, code int32, msg interface{}) {
	respData := map[string]interface{}{
		"code": code,
		"msg":  msg,
	}
	c.JSON(http.StatusOK, respData)
}

// 返回成功
func OK(c *gin.Context, data interface{}) {
	respData := map[string]interface{}{
		"code": 0,
		"data": data,
	}
	c.JSON(http.StatusOK, respData)
}
